package com.transparent;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.JToolBar;
import javax.swing.JSeparator;
import javax.swing.plaf.SeparatorUI;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.Color;
import java.awt.SystemColor;
import javax.swing.UIManager;

public class MainFrame extends JFrame {
	private static final long serialVersionUID = 1L;
	
	public MainFrame(String title) {
		super(title);
		
		// Creates a menubar for a JFrame
        JMenuBar menuBar = new JMenuBar();
        menuBar.setBackground(SystemColor.inactiveCaption);
        
        // Add the menubar to the frame
        setJMenuBar(menuBar);
        
        // Define and add two drop down menu to the menubar
        JMenu fileMenu = new JMenu("File");
        JMenu helpMenu = new JMenu("Help");

        menuBar.add(fileMenu);
        menuBar.add(helpMenu);
		
        // Create and add simple menu item to one of the drop down menu
        JMenuItem exitAction = new JMenuItem("Exit", new ImageIcon(this.getClass().getResource("exit.png")));
       
        fileMenu.add(exitAction);
        
        JMenuItem aboutHlpAction = new JMenuItem("About", new ImageIcon(this.getClass().getResource("about.png")));
        
        helpMenu.add(aboutHlpAction);
        
		///set layout manager
		getContentPane().setLayout(new BorderLayout());

		///create options panel on lhs
		final PanelTransparent pnlTransparent = new PanelTransparent(this, "Batch Background Transparency");
		pnlTransparent.setBackground(UIManager.getColor("TableHeader.background"));

		// add swing components to content pane
		Container c = getContentPane();
		
		final JTabbedPane tab = new JTabbedPane();
		c.add(tab, BorderLayout.CENTER);
		tab.add("Transparent", pnlTransparent);

 
        exitAction.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
        		System.exit(0);
            }
        });
        
       
        aboutHlpAction.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
        		JOptionPane.showMessageDialog(MainFrame.this,"Author: PK\nPackage: Batch PNG Transparency\nVersion: 0.1","About",JOptionPane.INFORMATION_MESSAGE);	
        	}
        });
        
       

	}
}
